// 在主进程中的 preload.ts 文件
const { contextBridge, ipcRenderer } = require('electron');
const fs = require('fs');
const path = require('path')

// 将需要访问的模块和方法添加到 contextBridge 中
contextBridge.exposeInMainWorld('nodeApi', {
  fs: fs,
  path: path,
});

contextBridge.exposeInMainWorld('electronApi', {
  ipcRenderer: {
    on: (channel, listener) => ipcRenderer.on(channel, listener),
    // send: (channel, ...args) => ipcRenderer.send(channel, ...args),
    ...ipcRenderer
  },
});
